/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
					     dialog_magic_university.cpp

	$Header: /game/dialog_magic_university.cpp $

	$NoKeywords: $

 ************************************************************************/
// kill the 255+ character identifier warning.  Templates tend to exceed that easily.
#include "precompiled.h"
#pragma warning( disable: 4786 )

#include "dialog_magic_university.h"

#include "basic_dialog.h"
#include "creature_icon_window.h"
#include "hero.h"

/*
** Show the result of skill purchase (may change).
*/
void display_skill(t_skill const&skill, t_window *parent_window, std::vector<t_hero*> const& heroes, std::string const& text)
{
	int i;
    t_basic_dialog* result_dialog_ptr;
	t_window*			parent;
	t_screen_rect       rect;
	t_screen_point      center;
	t_screen_rect parent_rect = parent_window->get_parent()->get_client_rect();
    
    result_dialog_ptr = new t_basic_dialog;

    if ( text != "" )
        result_dialog_ptr->set_text( text );

    result_dialog_ptr->add_skill (skill);

	/*
    ** Add the hero portrait windows
    */
	for (i = 0; i < heroes.size(); i++)
    {
	    t_window* window;

	    parent = new t_window( t_screen_rect(0,0,0,0), t_window::k_completely_transparent, result_dialog_ptr );

	    window = new t_creature_icon_window( rect, parent, heroes[i] );
	    rect = window->get_client_rect();
        rect -= t_screen_point( rect.width() / 2, 0 );
	    window->move( rect );
	    parent->set_size_from_children();

	    result_dialog_ptr->add_display_window( parent, heroes[i]->get_name() );
    }
    
    result_dialog_ptr->add_ok_button();
    
    result_dialog_ptr->open( true );
    result_dialog_ptr->run_modal();
}


